import { GET_ARTICLES, GET_CHANNELS } from "../constants"

const init = {
    channels: [],
    articles: []
}

export default function article(state = init, action) {
    if (action.type === GET_CHANNELS) {
        return {
            ...state,
            channels: action.payload
        }
    }
    if (action.type === GET_ARTICLES) {
        return {
            ...state,
            articles: action.payload
        }
    }
    return state
}